﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BasSynchronousInfo.aspx.cs" Inherits="JYH.Web.MES.Public.UI.BasSynchronousInfo" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script type="text/javascript">
        $(function () {

            TranslationPage();
            const url = new URL(window.location.href);
            // 使用URLSearchParams接口获取URL参数
            const params = new URLSearchParams(url.search);
            $("#hOrder").val(params.get('SynchName'));

            $('#SyncDate').datebox({
                formatter: function (date) {
                    var y = date.getFullYear();
                    var m = date.getMonth() + 1;
                    var d = date.getDate();
                    return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
                }
            });
         
        });

        let res = {};
        async function Translation() {
            if (res != null) {
                if (res.PageTitile != null) {
                    document.title = res.PageTitile;


                    $('#BtnSynchronous').linkbutton({
                        text: res.Synchronous
                    });

                    $('#SyncNO').textbox({
                        prompt: res.SyncNO

                    });

                    $('#SyncDate').datebox({
                        prompt: res.SyncDate
                        //lable: res.ReciveOrderNO
                    });

                    // $('#tt').datagrid('load'); // 加载数据
                }
            }
        }
        async function TranslationPage() {
            try {
                var lang = {
                    PageName: 'Public',
                    LanguageNO: navigator.language
                };
                var url = "/api/SYS/GetPageLanguage";
                let c = await $.ajax({
                    url: url, // 替换为你的API或服务器端点
                    type: 'POST', // 或者 'POST'，取决于你的请求类型
                    data: lang,
                    contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                    success: function (data) {
                        console.log(JSON.stringify(data));
                        // 假设你需要在请求成功后显示元素
                        if (data.Code == 200) {
                            res = data.Items[0];
                            if (res != null) {
                                Translation();
                            }
                       
                        }
                        if (data.Code == 500) {
                            Notice(data.Message);

                        }

                    },
                    error: function (xhr, status, error) {
                        // 错误处理
                    }
                });
            } catch (error) { }
            //  console.error('Request error:', error);
        };


        function Synchronous() {
            var SyncNO = $("#SyncNO").val();

            var SyncDate = $("#SyncDate").val();

            var hOrder = $("#hOrder").val();
            var lang = {
                SynchronousName: hOrder,
                Date: SyncDate,
                NO: SyncNO
            };
            var url = "/api/SYS/SynchronousData";
            DataService.PostJson(url, lang, function (err, res) {
                if (err) {
             
                    Notice( res.Message);
                  
                } else {
                    Alert(res);
                }
            })
        };

        function myformatter(date) {
            var y = date.getFullYear();
            var m = date.getMonth() + 1;
            var d = date.getDate();
       
            return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
        }
        function myparser(s) {
            if (!s) return new Date();
            var ss = (s.split('-'));
            var y = parseInt(ss[0], 10);
            var m = parseInt(ss[1], 10);
            var d = parseInt(ss[2], 10);
            if (!isNaN(y) && !isNaN(m) && !isNaN(d)) {
                return new Date(y, m - 1, d);
            } else {
                return new Date();
            }
        }
        </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:HiddenField runat="server" ID="hOrder" />
                <asp:HiddenField runat="server" ID="hDate" />
        <div class="pagebox">
            <div class="cbox">
                <!--工具栏-->

                <ul class="flist">
                    <li>
                        <input class="easyui-textbox" type="text" id="SyncNO" data-options="prompt:'请输入同步单号'" />
                    </li>
                </ul>
                <ul class="flist">
                    <li>
                        <input class="easyui-datebox" labelposition="top" id="SyncDate" data-options="prompt:'请选择日期'" />
                    </li>
                </ul>
                <div>
                    <a href="javascript:void(0)" class="easyui-linkbutton cl" onclick="Synchronous()" data-options="iconCls:'icon-search'">同步</a>
                </div>
            </div>


        </div>

    </form>
</body>
</html>
